import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
    {
        path: '/',
        redirect: '/home',
        component: () => import('../layout/index.vue'),
        children: [
            {
                path: "home",
                meta: {
                    title: "购物街"
                },
                name: "home",
                component: () => import('../views/home/Home.vue')
            },
            {
                path: "category",
                meta: {
                    title: "商品分类"
                },
                name: "category",
                component: () => import('../views/category/Category.vue')
            },
            {
                path: "car",
                meta: {
                    title: "购物车"
                },
                name: "car",
                component: () => import('../views/car/Car.vue')
            },
            {
                path: "profile",
                meta: {
                    title: "个人中心"
                },
                name: "profile",
                component: () => import('../views/profile/Profile.vue')
            }
        ]
    },
    {
        path: "/detail",
        component: () => import("../layout/detailLayout.vue"),
        children: [
            {
                path: ":id",
                name: "detail",
                component: () => import("../views/detail/Detail"),
            }
        ]
    }
]

export default new VueRouter({
    // mode: 'history',
    routes
})